/**
 *    Copyright 2012 Geensoft S.A.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 **/
package ar.com.greensoft.neo.model;

import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;

import org.hibernate.envers.Audited;
import org.hibernate.validator.constraints.Email;

/**
 * 
 * @author Jorge E. Villaverde
 * @since 06/03/2012
 * @version 1.0.0
 */
@Entity
@Table(name="obra_social")
@Inheritance(strategy=InheritanceType.JOINED)
@NamedQueries({
	@NamedQuery(name=ObraSocial.FIND_ALL_QUERY_NAME, query="SELECT p FROM ObraSocial p ORDER BY p.rnos"),
	@NamedQuery(name=ObraSocial.FIND_LIKE_NAME_QUERY_NAME, query="SELECT p FROM ObraSocial p WHERE p.name LIKE :name"),
	@NamedQuery(name=ObraSocial.FIND_BY_NAME_QUERY_NAME, query="SELECT p FROM ObraSocial p WHERE p.name = :name"),
	@NamedQuery(name=ObraSocial.COUNT_QUERY_NAME,    query="SELECT COUNT(p) FROM ObraSocial p")
})
@Audited
public class ObraSocial extends NamedEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public static final String FIND_ALL_QUERY_NAME = "ObraSocial.findAll";
	public static final String FIND_BY_NAME_QUERY_NAME = "ObraSocial.findByName";
	public static final String FIND_LIKE_NAME_QUERY_NAME = "ObraSocial.findNameLike";
	public static final String COUNT_QUERY_NAME = "ObraSocial.count";

	private long rnos;
	
	@Size(max=20)
	private String sigla;
	
	@Embedded
	private Direccion direccion = new Direccion();
	
	@Size(max=15)
	private String telefono1;
	
	@Size(max=15)
	private String telefono2;	
    
	@Email
	private String email;
	
	@Size(max = 255)
	private String web;

	@Column(name="activa")
	private boolean activa;

	
	public boolean isActiva() {
		return activa;
	}

	public void setActiva(boolean activa) {
		this.activa = activa;
	}

	public long getRnos() {
		return rnos;
	}

	public void setRnos(long rnos) {
		this.rnos = rnos;
	}

	public String getSigla() {
		return sigla;
	}

	public void setSigla(String sigla) {
		this.sigla = sigla;
	}

	public Direccion getDireccion() {
		return direccion;
	}

	public void setDireccion(Direccion direccion) {
		this.direccion = direccion;
	}

	public String getTelefono1() {
		return telefono1;
	}

	public void setTelefono1(String telefono1) {
		this.telefono1 = telefono1;
	}

	public String getTelefono2() {
		return telefono2;
	}

	public void setTelefono2(String telefono2) {
		this.telefono2 = telefono2;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getWeb() {
		return web;
	}

	public void setWeb(String web) {
		this.web = web;
	}
}
